package xyz.duolaf.myboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.duolaf.myboot.pojo.User;
import xyz.duolaf.myboot.service.UserService;
import xyz.duolaf.myboot.util.R;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/userList")
    public R getUserList(String param){
        List<User> userList = userService.getUserList();

        if ("1".equals(param)){
            return R.ok().put("list", userList);
        }
        return R.error(1,"have no permission");
    }
}
